<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%@page import="iwpl.project.entities.Accounts"%>
<%@page import="iwpl.project.dao.AccountsDAO"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
			Accounts acc1 =(Accounts)session.getAttribute("alogin");
			if(acc1==null)response.sendRedirect("login.jsp");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<center>

	<html>
		<head>
			<base href="<%=basePath%>">
<script type="text/javascript" src="js/jquery-Source.js"></script>
		<script type="text/javascript" src="js/jquery-Validation.js"></script>
		<link href="css/CommonCSS.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript">
			$(document).ready(function() {
				$("#Department").validate();
			});
			
	
			
			
		</script>
			<title>My JSP 'Template.jsp' starting page</title>

			<meta http-equiv="pragma" content="no-cache">
			<meta http-equiv="cache-control" content="no-cache">
			<meta http-equiv="expires" content="0">
			<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
			<meta http-equiv="description" content="This is my page">
			<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
			<link rel="stylesheet" href="css/menu.css" type="text/css" />
			<style type="text/css">
.styleTemplate1 {
	width: 780px;
}
</style>
		</head>

		<body>
<form name="frmChangePass" id="Department" action="./servlet/Control_Account"method="get">
			<table align="center" border="1px" cellpadding="0" cellspacing="0"
				style="width: 780px">
				<tr>
					<td>
						<table align="center">
						<%
							
							Integer id=0;
								String sAid ="";
								int sEmployee=0;
								String sRole="";
								String sUsername="";
								
								String sActive="";
								String spass="";
								AccountsDAO acc = new AccountsDAO();
								
								if(acc1!=null)
								{
									Accounts data = acc1;
									sAid = data.getId().toString();
									sEmployee = data.getEmployees().getId();
									sRole = data.getRoles().getRoleName();
									sUsername = data.getUserName();
									
									id=data.getId();
									sActive =  data.getActive().toString().toLowerCase();
									if(sActive.equals("true"))
										{
									 	sActive = "checked";
									 	}
									 else
									 {
									 response.sendRedirect("login.jsp");
									 }
								}
							
							%>
							<tr  bgcolor="5f9ff5">
								<td colspan="2">
								Change PassWord 
								<input type="hidden" name="action" value="ChangePassword" />
								<input type="hidden" name="cID" value="<%=sAid%>" />
								
								
								
								</td>
							</tr>
							<tr>
								<td>
								 Old Pass
								</td>
								<td>
								<input type="password"  class="required" name="txtOldPass"/>
								</td>
							</tr>
							<tr>
								<td>
								New Pass
								</td>
								<td>
								<%//<input id="password" name="password" type="password" /> %>
								
								
								<input type="password" class="required" name ="txtNewpass"/>
								</td>
							</tr>
							<tr>
								<td>
								Confirm
								</td>
								<td>
								<% //<input type="password" class="reqired" name="txt" name ="txtConfirm"/>%>
								<input class="required"  name="confirm_password" type="password" /> 
								</td>
							</tr>
							<tr>
								<td colspan="2" align="center">
									<input type="submit" name ="btnChange" value="Change" />
									<input type="button" name ="btnCancel" value="Cancel" onClick="self.location='index.jsp'" />
								</td>
							</tr>
							<tr>
									<td colspan="3">
										<%
											if(request.getParameter("message")!=null)
											{
												String a = request.getParameter("message").toString();
												out.print(a);
											}
										 %>
									</td>
								</tr>
						</table>
					</td>
				</tr>
			</table>

</form>
		</body>
	</html>
</center>